Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@janiscommerce/superstruct
Advanced tools
![Build Status](https://github.com/janis-commerce/superstruct/workflows/Build%20Status/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/janis-commerce/superstruct/badge.svg?branch=master)](https://coveralls.io/github/janis-commerce/superst
The following package complements the superstruct package, the same adds some methods to easily validate different types of data
npm install @janiscommerce/superstruct
The custom types that you can use in addition to the superstruct are:
email
This type checks if is a valid emailURL
This type checks if is a valid URLempty
This type checks if it's an empty string, array or a falsy value!empty
This type checks if it's not an empty string, array or a falsy valuelowercase
This type checks if is a valid lowercase stringuppercase
This type checks if is a valid uppercase stringcamelcase
This type checks if is a valid camelcase stringnumeric
This type checks if is a valid numeric valuemd5
This type checks if is a valid md5 hashJSON
This type checks if is a valid JSONISODate
This type checks if is a valid ISO Dateinteger
This type checks if is a integer numberpositive
This type checks if is a positive numberpositiveOrZero
This type checks if is a positive number or zeroobjectId
This type checks if is a ObjectId with 24 charactersUUID
This type checks if is a V4 UUIDhexColor
This type checks if is a Hexadecimal Colorconst { struct } = require('@janiscommerce/superstruct');
const userStruct = struct({
name: 'string',
email: 'email',
age: 'number',
password: 'md5',
image: 'URL',
mainColor: 'hexColor
});
const userData = {
name: 'John Doe',
email: 'emai@asd.com',
age: 28,
password: 'be5b0158b79c90c8358990f34ec18d43',
image: 'https://gravatar.com/avatar/23463b99b62a72f26ed677cc556c44e8?s=200',
hexColor: '#123456'
};
userStruct(userData);
[1.2.1] - 2022-09-20
FAQs
![Build Status](https://github.com/janis-commerce/superstruct/workflows/Build%20Status/badge.svg) [![Coverage Status](https://coveralls.io/repos/github/janis-commerce/superstruct/badge.svg?branch=master)](https://coveralls.io/github/janis-commerce/superst
The npm package @janiscommerce/superstruct receives a total of 246 weekly downloads. As such, @janiscommerce/superstruct popularity was classified as not popular.
We found that @janiscommerce/superstruct demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.